package com.hqyj.controller;


import com.hqyj.pojo.Question;
import com.hqyj.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author rock
 * @since 2021-11-12
 */
@RestController
@RequestMapping("/question")
public class QuestionController {
    //
    @Autowired
    private QuestionService questionService;

    @GetMapping("/getAll")
    public HashMap<String, Object> getAll(Question question){
        return questionService.getAllQuestion(question);
    }


    //get请求
    @GetMapping("/listGet")
    public HashMap<String,Object> list(Question q){
        return questionService.list(q);
    }

    //post请求
    @PostMapping("/listPost")
    public HashMap<String,Object> listPost(Question s){
        return questionService.list(s);
    }


    //修改
    @GetMapping("/update")
    public HashMap<String,Object> update(Question s){

        return questionService.update(s);
    }

    //新增
    @GetMapping("/add")
    public HashMap<String,Object> add(Question s){

        return questionService.add(s);
    }

    //删除
    @GetMapping("/delete")
    public HashMap<String,Object> delete(Integer id){

        return questionService.delete(id);
    }
}

